﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Facebook.Service;

public partial class History_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void gvStats_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridView ctrl = sender as GridView;
        if(ctrl != null)
        {
            Int32 sentPrankId = (Int32)ctrl.SelectedDataKey.Value;
            DBDataContext db = new DBDataContext();
            db.Log = new DebuggerWriter();
            List<String> recipients = (
                from r in db.sent_prank_recipients
                where r.sent_prank_id == sentPrankId
                select r.recipient_id.ToString()).ToList();
            ICollection<User> users = Master.ParentApp.Service.Users.GetUsers(recipients, "name,first_name,last_name,pic_square,affiliations,birthday");
            //List<String> recipientNames = (from u in users select u.Name).ToList();
            this.gvDetails.DataSource = users;
            this.gvDetails.DataBind();
            //this.Repeater1.DataSource = recipientNames;
            //this.Repeater1.DataBind();
        }
    }
}
